Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport "Avoid generating given definitions that loop" #19477

Merged
merged 11 commits into from
Jan 18, 2024

Conversation

Kordyjan
Copy link
Contributor

Backports #19282 with later improvements (#19392, #19411) to 3.4.0

`given ... with` or `given ... = new { ... }` kinds of definitions now follow
the old rules. This allows recursive `given...with` definitions as they are
found in protoQuill.

We still have the old check in a later phase against directly recursive methods.
Of the three loops in the original i15474 we now detect #2 and #3 with new new
restrictions. #1 slips through since it is a loop involving a `given...with` instance
of `Conversion`, but is caught later with the recursive method check.

Previously tests #1 and #3 were detected with the recursive methods check and #2 slipped
through altogether.

The new rules are enough for defining simple givens with `=` without fear of looping.
Drop the experimental language import. I believe everybody agrees that this
is a desirable improvement, and type inference and implicit search
have traditionally been in the realm of the compiler implementers.

Experimental language imports have to live forever (albeit as deprecated
once the feature is accepted as standard). So they are rather heavyweight
and it is unergonomic to require them for smallish improvements to type
inference.

The new road map is as follows:

 - In 3.4: warning if behavior would change in the future.
 - In 3.5: error if behavior would change in the future
 - In 3.future (at the earliest 3.6): new behavior.
@Kordyjan Kordyjan merged commit 7263790 into release-3.4.0 Jan 18, 2024
36 of 37 checks passed
@Kordyjan Kordyjan deleted the 19282-on-3.4.0 branch January 18, 2024 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants